<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var a = [10, 20, 30, 40];
for(var i = 0; i < 10; i++){
    foo(i)
}
function foo(n){
    console.log(n);
}
</script>
</body>
</html>